//
//  CusTabbleViewVC.m
//  FrameWork2.0
//
//  Created by jiaming yan on 2016/12/27.
//  Copyright © 2016年 yanjiaming. All rights reserved.
//

#import "CusTabbleViewVC.h"
#import "CusTabbleTableViewCell.h"
@interface CusTabbleViewVC ()
@property (weak, nonatomic) IBOutlet UITableView *tableView;
@property (strong, nonatomic)  NSArray *arrData;//图片名数组
@end

@implementation CusTabbleViewVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self.tableView registerNib:[UINib nibWithNibName:@"CusTabbleTableViewCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"CusTabbleTableViewCell"];
    self.tableView.estimatedRowHeight = 500;  //  随便设个不那么离谱的值
    self.tableView.rowHeight = UITableViewAutomaticDimension;
    self.arrData = @[@"UITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimension",@"UITableViewAutomatAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimensionUITableViewAutomaticDimension",@"UITableViewAutomaticDimensi"];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - UITableViewDataSource

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    
    return self.arrData.count;
}

//- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
//{
//    return 44;
//}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    static NSString *identifier = @"CusTabbleTableViewCell";
    CusTabbleTableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:identifier];
    if (cell == nil) {
        NSArray *nibs = [[NSBundle mainBundle]loadNibNamed:@"CusTabbleTableViewCell" owner:nil options:nil];
        cell = [nibs firstObject];
    }
//    cell.labelTitle.text = self.arrData[indexPath.row];
    cell.labelContent.text = self.arrData[indexPath.row];
    cell.labelContent.numberOfLines = 0;
    switch (indexPath.row) {
        case 0:
        {
             cell.viewImageBack.constant = 50;
        }
            break;
        case 1:
        {
             cell.viewImageBack.constant = 100;
        }
            break;
        case 2:
        {
             cell.viewImageBack.constant = 150;
        }
            break;
        default:
            break;
    }
    return cell;
}
- (void )tableView:(UITableView *)tableView didSelectRowAtIndexPath:(nonnull NSIndexPath *)indexPath
{
    
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
